<script>
import { useGlobalStore } from '@/store/global'
import { netConfig } from './config/net.config'
export default {
  onLaunch: function () {
    console.log('App Launch')

    uni.loadFontFace({
      global: true,
      family: 'SourceHans',
      source: `url("${netConfig.cdnUrl}static/fonts/SourceHanSansCN-Regular.otf")`,
      // source: 'url("./static/fonts/SourceHanSansCN-Regular.otf")',
      success: (result) => {
        console.log('font load success', result)
      },
      fail: (error) => {
        console.log('font load fail', error)
      },
      complete() {
        console.log('complete')
      },
    })

    // 初始化全局数据
    const globalStore = useGlobalStore()
    globalStore.initProvinceData()
  },
  onShow: function () {
    console.log('App Show')
  },
  onHide: function () {
    console.log('App Hide')
  },
}
</script>

<style lang="scss">
/*每个页面公共css */
@import 'uview-plus/index.scss';
view,
text,
input {
  font-family: 'SourceHans', sans-serif;
  font-optical-sizing: auto;
  font-style: normal;
}
</style>
